﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using Models;

namespace BLL
{
    public class UserBLL
    {
        private UserDAL dal = new UserDAL();

        /// <summary>
        /// 增加一行用户数据
        /// </summary>
        /// <returns></returns>
        public bool AddUser(UserInfo user)
        {
            return dal.AddUser(user);
        }

        /// <summary>
        /// 执行查询，获取所有用户数据
        /// </summary>
        /// <returns></returns>
        public DataSet GetUserList()
        {
            return dal.GetUserList();
        }

        /// <summary>
        /// 执行查询，判断密码是否正确，根据用户ID获取用户数据
        /// </summary>
        /// <returns></returns>
        public DataTable GetUserList(UserInfo user)
        {
            return dal.GetUserList(user);
        }


        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="user">传入修改后的密码和用户id</param>
        /// <returns></returns>
        public bool UpUserPwd(UserInfo user)
        {
            return dal.UpUserPwd(user);
        }

        /// <summary>
        /// 修改用户信息
        /// </summary>
        /// <param name="user">传入用户实体类，主要id</param>
        /// <returns></returns>
        public bool UpUser(UserInfo user)
        {
            return dal.UpUser(user);
        }

        /// <summary>
        /// 用户管理，改变用户状态
        /// </summary>
        /// <param name="user">传入用户实体类，主要id</param>
        /// <param name="op">1：启用 2：封停</param>
        /// <returns></returns>
        public bool AdminUser(UserInfo user)
        {
            return dal.AdminUser(user);
        }
    }
}
